<?php
/**
 * Created by PhpStorm.
 * User: sunquan
 * Date: 2019/2/22
 * Time: 14:30
 */
namespace App\Services\Record;

use App\Model\Record;
use Illuminate\Support\Facades\DB;

class RecordService
{
    /*
     *  简历投递列表
     *  @ $id  用户id
     */
    static function list($id){
        $sql = "select `name`,`position_name`,`r_name`,r.created_at,`state`,`reason`,re.industry_id from record as r inner JOIN resume as re on r.resume_id=re.industry_id join company as c on r.company_id=c.id join position as p on r.position_id=p.position_id where r.uid=$id";
        $res = DB::select($sql);
        // 将数据转化为数组
        foreach ( $res as &$v ){
            $v = (array)$v;
            switch ($v['state']){
                case 1:$v['status'] = "已投递";break;
                case 2:$v['status'] = "已查看";break;
                case 3:$v['status'] = "已拒绝";break;
            }
        }
        return $res;
    }
}